#include<iostream>
#include<algorithm>
#include<map>
#include<cstring>
using namespace std;
typedef long long LL;
const int N = 510;
int n;
int a[N];
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n;
		bool flag = 0;
		for (int i = 1; i <= n; i++) {
			cin >> a[i];
			if (a[i] < a[i - 1])flag = 1;
		}
		if (flag) {
			cout << 0 << endl;
			continue;
		}
		int ans = 1e9 + 10;
		for (int i = 2; i <= n; i++) {
			ans = min(ans, a[i] - a[i - 1]);
		}
		//cout << "ans==" << ans << endl;
		if (!ans) {
			cout << 1 << endl;
			continue;
		}
		cout << ans / 2 + 1 << endl;
	}
	return 0;
}
